package com.yesorno.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yesorno.constants.Constants;
import com.yesorno.ui.CustomTitleActivity;

public class RegistActivity extends CustomTitleActivity {

	private Button goBack;

	private EditText passText;
	private EditText pwdText;

	RegBtnsClickListeners rbc = new RegBtnsClickListeners();

	/**
	 * 注册页面按钮的监听类
	 * 
	 * @author samoin
	 * @date 2011-07-06
	 * @version 0.1
	 * 
	 */
	class RegBtnsClickListeners implements OnClickListener {
		@Override
		public void onClick(View v) {
			if (v == goBack) {
				Intent intent = new Intent();
				intent.putExtra("test", "reg");
				RegistActivity.this.setResult(RESULT_OK, intent);
				RegistActivity.this.finish();
			}
		}

	}

	@Override
	public void setTitleViews() {
		LinearLayout titleLayout = getTITLE_LAYOUT();
		goBack = CustomTitleActivity.createTitleLeftButton(RegistActivity.this,
				R.string.reg_title_btn_goback, Constants.TITLE_BTN_MARGIN1);
		goBack.setOnClickListener(rbc);
		titleLayout.addView((View) goBack.getParent());
		TextView tv = CustomTitleActivity.createTitleDesc(RegistActivity.this,
				R.string.reg_title_common, 0);
		titleLayout.addView((View) tv.getParent());
		titleLayout.addView((View) CustomTitleActivity.createTitleDesc(
				RegistActivity.this, 0, 0).getParent());
	}

	@Override
	public void setLayoutId() {
		setContentView(R.layout.regist);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		resetViews();
	}

	private void resetViews() {
		passText = (EditText) findViewById(R.id.reg_pass);
		pwdText = (EditText) findViewById(R.id.reg_pwd);
		passText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
		pwdText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
	}

}
